/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package edu.spbu.eclipse.gmftests.zhukowazalog.mmodel.impl;

import edu.spbu.eclipse.gmftests.zhukowazalog.mmodel.Connexion;
import edu.spbu.eclipse.gmftests.zhukowazalog.mmodel.MmodelPackage;
import edu.spbu.eclipse.gmftests.zhukowazalog.mmodel.Polygon;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Connexion</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link edu.spbu.eclipse.gmftests.zhukowazalog.mmodel.impl.ConnexionImpl#getBeginning <em>Beginning</em>}</li>
 *   <li>{@link edu.spbu.eclipse.gmftests.zhukowazalog.mmodel.impl.ConnexionImpl#getEnding <em>Ending</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ConnexionImpl extends EObjectImpl implements Connexion {
	/**
	 * The cached value of the '{@link #getBeginning() <em>Beginning</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getBeginning()
	 * @generated
	 * @ordered
	 */
	protected Polygon beginning = null;

	/**
	 * The cached value of the '{@link #getEnding() <em>Ending</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEnding()
	 * @generated
	 * @ordered
	 */
	protected Polygon ending = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ConnexionImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected EClass eStaticClass() {
		return MmodelPackage.Literals.CONNEXION;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Polygon getBeginning() {
		if (beginning != null && beginning.eIsProxy()) {
			InternalEObject oldBeginning = (InternalEObject)beginning;
			beginning = (Polygon)eResolveProxy(oldBeginning);
			if (beginning != oldBeginning) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, MmodelPackage.CONNEXION__BEGINNING, oldBeginning, beginning));
			}
		}
		return beginning;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Polygon basicGetBeginning() {
		return beginning;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setBeginning(Polygon newBeginning) {
		Polygon oldBeginning = beginning;
		beginning = newBeginning;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, MmodelPackage.CONNEXION__BEGINNING, oldBeginning, beginning));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Polygon getEnding() {
		if (ending != null && ending.eIsProxy()) {
			InternalEObject oldEnding = (InternalEObject)ending;
			ending = (Polygon)eResolveProxy(oldEnding);
			if (ending != oldEnding) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, MmodelPackage.CONNEXION__ENDING, oldEnding, ending));
			}
		}
		return ending;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Polygon basicGetEnding() {
		return ending;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setEnding(Polygon newEnding) {
		Polygon oldEnding = ending;
		ending = newEnding;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, MmodelPackage.CONNEXION__ENDING, oldEnding, ending));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case MmodelPackage.CONNEXION__BEGINNING:
				if (resolve) return getBeginning();
				return basicGetBeginning();
			case MmodelPackage.CONNEXION__ENDING:
				if (resolve) return getEnding();
				return basicGetEnding();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case MmodelPackage.CONNEXION__BEGINNING:
				setBeginning((Polygon)newValue);
				return;
			case MmodelPackage.CONNEXION__ENDING:
				setEnding((Polygon)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void eUnset(int featureID) {
		switch (featureID) {
			case MmodelPackage.CONNEXION__BEGINNING:
				setBeginning((Polygon)null);
				return;
			case MmodelPackage.CONNEXION__ENDING:
				setEnding((Polygon)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case MmodelPackage.CONNEXION__BEGINNING:
				return beginning != null;
			case MmodelPackage.CONNEXION__ENDING:
				return ending != null;
		}
		return super.eIsSet(featureID);
	}

} //ConnexionImpl